 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 商品管理</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="{$Think.config.site.common_resource_url}js/chosen/chosen.css" rel="stylesheet" type="text/css"/>
</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}
.specval-hide{display: none;}

.brand-tag,.supplier-tag{
    display: inline-block;
    padding: 0px 6px;
    color: #fff;
    /*border: 1px solid #f00;*/
    border-radius: 10px;
    background-color: rgb(0, 170, 238);
}
.supplier-tag{    background-color: rgb(34, 204, 119);}

.{border-top: 2px solid #999 !important;}

.input-group select{width: 100%}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商品列表</h5>
                        <span class="tag">说明：点击确定按钮,修改商品价格为市场价</span>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
                            <table class="table" id="listtable">
                                <thead>
                                    <tr>
                                        <th width="100">商品图片</th>
                                        <th width="">商品名称</th>
                                        <th width="">时间</th>
                                        <th width="">采购员</th>
                                        <th width="150">商品价</span></th>
                                        <th width="150">市场价</th>
                                        <th width="200">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	{volist name="list" id="vo"}
										<tr data-id="{$vo.specval_id}" data-pg_id="{$vo.pg_id}">
											<td class=""><img src="{$vo.picture}" width="30" height="30" class="preview" href="{$vo.picture}" title="{$vo.goods_name}"></td>
											<td class="goodsname ">{$vo.goods_name} <span class="brand-tag">{$vo.brand_name}</span> </td>
                                            <td class="">{$vo.create_time} </td>
                                            <td class="">{$vo.employee_name} </td>
											<td class=" price">{$vo.price}</td>
											<td class=""><input type="number" class="form-control purchase_price" value="{$vo.purchase_price}"  step="0.01"/></td>
											<td class="">
                                                <button type="button" class="btn btn-primary btn-sm change">确定</button>
                                                <button type="button" class="btn btn-primary btn-sm ignore">忽略</button>
                                            </td>
										</tr>
                                   {/volist}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>
    <script src="{$Think.config.site.resource_url}js/jquery.imagePreview.1.0.js"></script>
    <script type="text/javascript" src="{$Think.config.site.common_resource_url}js/chosen/chosen.jquery.js"></script>
</body>

</html>
<script>
$(document).on('click','.change',function(){
	var $this = $(this);
    layer.confirm('确定同步商城价格？', {
        btn: ['确定','取消'], //按钮
        shade: false //不显示遮罩
    }, function(){
        //确定删除
        var specval_id = $this.closest('tr').data('id');
        var purchase_price = parseFloat($this.closest('tr').find('.purchase_price').val()).toFixed(2);
        var pg_id = $this.closest('tr').data('pg_id');
        majax('{:url("change")}',{specval_id: specval_id,purchase_price: purchase_price,pg_id:pg_id},function(msg){
            if(msg.code == 1){
                $this.closest('tr').remove();
                layer.msg(msg.msg,{icon: 1});
            }else{
                layer.msg(msg.msg,{icon: 5});
            }
        });
    },
    function(){
        
    });
	
});

$(document).on('click','.ignore',function(){
    var $this = $(this);
    layer.confirm('确定忽略申请？', {
        btn: ['确定','取消'], //按钮
        shade: false //不显示遮罩
    }, function(){
        //确定删除
        var pg_id = $this.closest('tr').data('pg_id');

        majax('{:url("ignore")}',{pg_id: pg_id},function(msg){
            if(msg.code == 1){
                $this.closest('tr').remove();
                layer.msg(msg.msg,{icon: 1});
            }else{
                layer.msg(msg.msg,{icon: 2});
            }
        });
    },
    function(){
        
    });
    
});
</script>